#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    int findMin(vector<int>& nums)
    {
        int left = 0, right = nums.size() - 1;
        return BinarySearchMin(nums, left, right);
    }

private:
    int BinarySearchMin(const std::vector<int>& nums, int left, int right)
    {
        if (left == right)
        {
            return nums[left];
        }

        int mid = (left + right + 1) >> 1;
        if (nums[left] > nums[mid])
        {
            return BinarySearchMin(nums, left + 1, mid);
        }
        else
        {
            return std::min(nums[left], BinarySearchMin(nums, mid, right));
        }
    }
};